<template>
	<view class="content">

		<view class="flexbc li" v-for="item in yue2.reward_other" :key="item.id" v-if="xianzaiindex == 1">
			<view class="slh" style="flex-grow: 1;">
				<view style="font-size: 32rpx;color: #333;margin-bottom: 20rpx;">{{item.content}}</view>
				<view style="color: #878787;">{{item.created_at}}</view>
			</view>
			<view style="width: 200rpx;text-align: right;  font-size: 30rpx; font-weight: bold;">-{{item.points}}</view>
		</view>
		<view class="flexbc li" v-for="item in yue2.reward_me" :key="item.id"  v-if="xianzaiindex == 2">
			<view class="slh" style="flex-grow: 1;">
				<view style="font-size: 32rpx;color: #333;margin-bottom: 20rpx;">{{item.content}}</view>
				<view style="color: #878787;">{{item.created_at}}</view>
			</view>
			<view style="width: 200rpx;text-align: right; font-size: 30rpx;font-weight: bold;">+{{item.points}}</view>
		</view>
		<view style="width: 100vw;height: 100vh;" class="flexcc" v-if="yue2.reward_other == '' && xianzaiindex == 1">
			<u-empty
			        mode="list"
			        icon="http://cdn.uviewui.com/uview/empty/list.png"
			>
			</u-empty>
		</view>
		<view style="width: 100vw;height: 100vh;" class="flexcc" v-if="yue2.reward_me == '' && xianzaiindex == 2">
			<u-empty
			        mode="list"
			        icon="http://cdn.uviewui.com/uview/empty/list.png"
			>
			</u-empty>
		</view>
		<u-overlay :show="loading">
			<view class="flexcc" style="width: 100vw;height: 100vh;">
				<u-loading-icon color="#fff" text="加载中..." :vertical="true" textColor="#fff"></u-loading-icon>
			</view>
		</u-overlay>
		<u-toast ref="uToast2"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				yue:"",
				yue2:"",
				loading:true,
				list:[
					{name: '充值记录'},
					{name: '提现记录'},
					{name: '打赏记录'},
					{name: '获赏记录'}
				],
				xianzai:"充值记录",
				xianzaiindex:1
			}
		},
		onLoad(option) {

			if(option.index){
				this.xianzaiindex = option.index
				
				let name = '打赏支出'
				if(this.xianzaiindex ==2){
					name = '打赏收入'
				}
				setTimeout(function() {
					document.title =  uni.getStorageSync('group_name')+name;
					
					var iframe = document.createElement('iframe');
					iframe.style.visibility = 'hidden';
					iframe.style.width = '1px';
					iframe.style.height = '1px';
					iframe.onload = function() {
						setTimeout(function() {
							document.body.removeChild(iframe);
						}, 0);
					};
					document.body.appendChild(iframe);
				}, 0);
			}
			this.getyue2()
		},
		computed:{
			
		},
		methods: {
			
			getyue2: function() {
				let data = {
					token: uni.getStorageSync('token'),
					game_id: uni.getStorageSync('activity_id'),
					page:1,
					page_size:500
				}
				this.yibuget('/api/v1/users/my_reward',data).then((res)=>{
					this.yue2 = res.data.data
					this.loading = false
				})
			},
			zzs:function(){
				let x = this.value.toString().replace(/[^0-9]/g,'')
				if(x > this.yue.balance){
					x = this.yue.balance
				}
				this.$nextTick(item=>{
					this.value = x
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.content { background: #F9F9F9; padding: 20rpx; min-height: 100vh;
		.li{ padding: 30rpx 30rpx;  border-bottom:1px #DFDFDF solid;}
	}
</style>
